package atm;

public class Account 
{

	private int accountNumber;
	private double balance;
	
	public Account(int accountNumber, double balance)
	{
		this.accountNumber=accountNumber;
		this.balance=balance;
	}
	public Account(int accountNumb)
	{
		this.accountNumber=accountNumb;
		balance=0;
	}
	public int getAccountNumber()
	{
		return accountNumber;
	}
	public double getBalance()
	{
		return balance;
	}
	public void setBalance(double balance)
	{
		this.balance=balance;
	}
	public void credit(double amount)
	{
			balance+=amount;
	}
	public void debit(double amount)
	{
		if(balance<amount)
		{
			System.out.println("Amount withdrawn exceeds the current balance");
		}
		else
		{
			balance-=amount;
		}
	}
	public String toString()
	{
		return String.format("Balance in A/C no %d is %.2f", accountNumber, balance);
	}
}
